package day14_21.day18;

import javax.security.sasl.SaslClient;
import java.util.Scanner;

public class Main02 {
    public static void main(String[] args) {
        Scanner scn = new Scanner(System.in);
        String str1 = scn.next();
        String str2 = scn.next();
        if (!str1.contains("?") && !str1.contains("*")){
            System.out.println(str1.equalsIgnoreCase(str2));
        }
        if (str1.contains("?")){
            if (str1.length() != str2.length()){
                System.out.println(false);
            }else {
                String[] s1 = str1.split("");
                String[] s2 = str2.split("");
                for (int i = 0; i < s1.length; i++) {
                    if (!s1[i].equals("?") && !s1[i].equalsIgnoreCase(s2[i])){
                        System.out.println(false);
                    }else {
                        System.out.println(true);
                    }
                }
            }
        }else {
            String[] s1 = str1.split("");
            String[] s2 = str2.split("");
            for (int i = 0; i < s1.length; i++) {
                if (!s1[i].equals("*") && !s1[i].equalsIgnoreCase(s2[i])){
                    System.out.println(false);
                }else {
                    System.out.println(true);
                }
            }
        }
    }
}
